
//  This works only if marker is not present in the given array 

package org.bhavani.duplicateEleArray;
import java.util.Arrays;

public class Removeduplicates {
	int[] numOfArray;
	
	public int[] RemoveDuplicates(int[] numOfArray){
		Arrays.sort(numOfArray);
		for (int i = 0; i < numOfArray.length; i++) {

			if(numOfArray[i] == numOfArray[i+1]){
			     numOfArray[i] = 0 ;

			}
			i++ ;

		}
		return numOfArray;
	}
	
	public String toString(){
		String s = " ";
		for (int i = 0; i < numOfArray.length; i++) {
			s += numOfArray[i];
			System.out.print(numOfArray[i]);
			
		}
		return s ;
		
		
	}

     public static void main(String ars[]){
    	 int[] numOfArray ={1,2,1,2,3,3,4,7};
    	 Removeduplicates duplicate = new Removeduplicates();
    	int[] dup = duplicate.RemoveDuplicates( numOfArray);
    	for (int i = 0; i < dup.length; i++) {
    		System.out.print(dup[i]);
			
		}
     }

}
